package com.boyadegroot.divelog.models;

import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.NonNull;

public class DiveOrganization implements Parcelable, Comparable<DiveOrganization> {

    private static final String TAG = DiveOrganization.class.getName();

    private long mId;
    private String mName;
    private String mFullName;

    public DiveOrganization() {}

    public DiveOrganization(long id, String name, String fullname) {
        this.setId(id);
        this.setName(name);
        this.setFullName(fullname);
    }

    public long getId() {
        return mId;
    }

    public void setId(long id) {
        this.mId = id;
    }
    
    public String getName() {
        return mName;
    }

    public void setName(String name) {
        this.mName = name;
    }

    public String getFullName() {
        return mFullName;
    }

    public void setFullName(String fullname) {
        this.mFullName = fullname;
    }

    @Override
    public int compareTo(@NonNull DiveOrganization another) {
        return this.mName.compareTo(another.mName);
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public String toString() {
        return getName();
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeLong(mId);
        dest.writeString(mName);
        dest.writeString(mFullName);
    }

    public static final Parcelable.Creator<DiveOrganization> CREATOR = new Parcelable.Creator<DiveOrganization>() {

        public DiveOrganization createFromParcel(Parcel in) {
            return new DiveOrganization(in);
        }

        public DiveOrganization[] newArray(int size) {
            return new DiveOrganization[size];
        }
    };

    private DiveOrganization(Parcel in) {
        mId = in.readLong();
        mName = in.readString();
        mFullName = in.readString();
    }
}
